package thread;

import java.sql.SQLOutput;

public class SleepDemo2 {
    public static void main(String[] args) {
        /*Thread lin = new Thread("林永健"){
            public void run(){
                try {
                    System.out.println(getName()+":刚美完容，睡一会吧~~");
                    Thread.sleep(1000000L);
                } catch (InterruptedException e) {
                    System.out.println(getName()+":干什么！");
                }
                System.out.println(getName()+":睡醒了");
            }
        };
        Thread huang = new Thread("黄宏"){
            public void run(){
                System.out.println(getName()+":大锤80!小锤40!开始砸!");
                for(int i = 0;i<5;i++){
                    System.out.println(getName()+":80!");
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {

                    }
                }
                System.out.println("大哥！搞定！");
                lin.interrupt();
            }
        };
        lin.start();
        huang.start();*/

        Thread lin = new Thread(){
            public void run(){
                try {
                    System.out.println("刚美完容，睡一会。");
                    Thread.sleep(1000000L);
                } catch (InterruptedException e) {
                    System.out.println("你干嘛！");
                }
                System.out.println("睡醒了");
            }
        };
        Thread huang = new Thread(){
            public void run(){
                System.out.println("大锤80！小锤40！开始砸！");
                try {
                    for(int i = 0;i < 5;i++){
                        System.out.println("80!");
                        Thread.sleep(1000L);
                    }
                    System.out.println("大哥，搞定！");
                    lin.interrupt();
                } catch (InterruptedException e) {

                }
            }
        };
        lin.start();
        huang.start();
    }
}
